<?php

include_once("core/controller.php");
include_once("core/versionHandler.php");
include_once("models/maps/map.php");

/**
 * @copyright joel SIMOes
 * @package map
 *
 */
class mapDel extends Controller{
	private $map_id;
	private $currentMap;
	private $doorPoints = array();


	public function isLegitimate(){


		return true;
	}

	public function actions(){
		$versionH = new VersionHandler("");
		$this->response->add($versionH->getMyVersion());
		
		$mapId = round($this->request->get('mapid'));
		
		$map = new Map('rw', 'id', $mapId);
		if (!$map->isOk())
		{
			echo "Map not found";
			exit();
		}
		$map->delete();
		$map = null;
		
		exit();

	}

	public function defaultActions(){
		if (!$this->currentMap->isOk())
		{
			header("location: index.php?action=mapList");
			exit();
		}
		$this->response->setXSLT("views/login.xsl");
	}

	
}